package com.tuju.jetpackfirstdemo.adapter

import android.view.View
import android.view.ViewGroup
import androidx.recyclerview.widget.LinearLayoutManager
import com.tuju.jetpackfirstdemo.R
import com.tuju.jetpackfirstdemo.base.baseadapter.BaseRecyclerViewAdapter
import com.tuju.jetpackfirstdemo.base.baseadapter.BaseRecyclerViewHolder
import kotlinx.android.synthetic.main.item_recyclerview.view.*

class RecyclerAdapter : BaseRecyclerViewAdapter<List<String>>() {

    override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): BaseRecyclerViewHolder<List<String>> {
        return ViewHolder(getView(parent, R.layout.item_recyclerview))
    }

    inner class ViewHolder(view:View) : BaseRecyclerViewHolder<List<String>>(view) {
        override fun onBaseBindViewHolder(t: List<String>, position: Int) {
            val columnAdapter = StringAdapter()
            columnAdapter.addAll(t)

            view.rv_date.layoutManager = LinearLayoutManager(view.context,LinearLayoutManager.HORIZONTAL,false)
            view.rv_date.adapter = columnAdapter
            view.rv_date.setHasFixedSize(true)
            view.rv_date.isNestedScrollingEnabled = false
        }
    }

}